package com.aweqy.hrmanager.controller;

import com.aweqy.hrmanager.entity.Customer;
import com.aweqy.hrmanager.service.CustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;

@RestController
@RequestMapping("/api/customers")
public class CustomerController {
    @Autowired
    private CustomerService customerService;

    @GetMapping
    public List<Customer> list() {
        return customerService.list();
    }

    @PostMapping
    public boolean add(@RequestBody Customer customer) {
        return customerService.save(customer);
    }

    @PutMapping
    public boolean update(@RequestBody Customer customer) {
        return customerService.updateById(customer);
    }

    @DeleteMapping("/{id}")
    public boolean delete(@PathVariable Integer id) {
        return customerService.removeById(id);
    }
} 